﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Audio;

namespace MapLibrary.Sound
{
    public class SoundManager
    {
        private static SoundManager soundManager;

        public AudioEngine AudioEngine { get; set; }
        public WaveBank WaveBank { get; set; }
        public SoundBank SoundBank { get; set; }

        private SoundManager()
        {

        }

        public static SoundManager GetSoundManager()
        {
            if (soundManager == null)
            { 
                soundManager = new SoundManager();
            }
            return soundManager;
        }

        public void PlayCue(string cue)
        {
            if (AudioEngine == null || SoundBank == null)
            {
                return;
            }
            else
            {
                SoundBank.PlayCue(cue);
            }
        }

        public void Initialize(string audio, string wave, string sound)
        {
            try
            {
                AudioEngine = new AudioEngine(audio);
                WaveBank = new WaveBank(AudioEngine, wave);
                SoundBank = new SoundBank(AudioEngine, sound);
            }
            catch
            {

            }
        }
    }
}
